feat: pass songs param from Slack bot to content creation#378
feat: pass songs param from Slack bot to content creation#378sweetmantech merged 6 commits intotestfrom
Conversation
The AI prompt parser now extracts song names from natural-language Slack mentions (e.g. "make a lipsync video for the hiccups song") and forwards them to triggerCreateContent so the pipeline filters to the requested songs. Co-Authored-By: Paperclip <noreply@paperclip.ing>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 10 minutes and 0 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdded an optional Changes
Sequence Diagram(s)sequenceDiagram
participant Mention as MentionEvent
participant Parser as parseContentPrompt
participant Handler as registerOnNewMention
participant Creator as triggerCreateContent
rect rgba(200,220,255,0.5)
Mention->>Parser: deliver mention text
Parser-->>Handler: flags {lipsync, batch, captionLength, songs?, ...}
Handler->>Creator: payload {flags..., songs?}
Creator->>Creator: create content job (persist/queue)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/agents/content/createContentPromptAgent.ts`:
- Around line 33-38: Update the "songs" Zod schema so that if provided it cannot
be an empty array and each string is trimmed: change songs from
z.array(z.string().min(1)).optional() to
z.array(z.string().trim().min(1)).min(1).optional() (preserving the existing
.describe text); this enforces non-empty, trimmed song strings at the schema
level and aligns with the downstream check that expects a non-empty songs array.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4857311a-63d6-4948-8659-ee7d77b35ee5
⛔ Files ignored due to path filters (2)
lib/agents/content/__tests__/parseContentPrompt.test.tsis excluded by!**/*.test.*,!**/__tests__/**and included bylib/**lib/agents/content/__tests__/registerOnNewMention.test.tsis excluded by!**/*.test.*,!**/__tests__/**and included bylib/**
📒 Files selected for processing (2)
lib/agents/content/createContentPromptAgent.tslib/agents/content/handlers/registerOnNewMention.ts
Both validateCreateContentBody and createContentPromptAgent now import from a single songsSchema definition. Validation rules only need to change in one place. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Moves CAPTION_LENGTHS to lib/content/captionLengths.ts so both validateCreateContentBody and createContentPromptAgent share the same source of truth. Re-exported from validateCreateContentBody for backward compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lib/content/validateCreateContentBody.ts (1)
14-16: Keep this validation module single-purpose by removingCAPTION_LENGTHSre-export.Line 16 makes this file act as a constants barrel in addition to request validation. Prefer importing
CAPTION_LENGTHSdirectly from@/lib/content/captionLengthsin consumers.♻️ Suggested minimal change
import { CAPTION_LENGTHS } from "@/lib/content/captionLengths"; - -export { CAPTION_LENGTHS };As per coding guidelines,
lib/**/*.tsshould "Apply Single Responsibility Principle (SRP): one exported function per file; each file should do one thing well".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/content/validateCreateContentBody.ts` around lines 14 - 16, Remove the CAPTION_LENGTHS re-export from this validation module so it only handles request validation: delete the line exporting CAPTION_LENGTHS from validateCreateContentBody.ts and update any consumers to import CAPTION_LENGTHS directly from "@/lib/content/captionLengths"; ensure the validation functions (e.g., the exported validator in validateCreateContentBody.ts) remain unchanged and the file no longer serves as a constants barrel.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@lib/content/validateCreateContentBody.ts`:
- Around line 14-16: Remove the CAPTION_LENGTHS re-export from this validation
module so it only handles request validation: delete the line exporting
CAPTION_LENGTHS from validateCreateContentBody.ts and update any consumers to
import CAPTION_LENGTHS directly from "@/lib/content/captionLengths"; ensure the
validation functions (e.g., the exported validator in
validateCreateContentBody.ts) remain unchanged and the file no longer serves as
a constants barrel.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: db375f6f-af74-4068-bd88-16d7df51aec3
⛔ Files ignored due to path filters (2)
lib/content/__tests__/captionLengths.test.tsis excluded by!**/*.test.*,!**/__tests__/**and included bylib/**lib/content/__tests__/songsSchema.test.tsis excluded by!**/*.test.*,!**/__tests__/**and included bylib/**
📒 Files selected for processing (4)
lib/agents/content/createContentPromptAgent.tslib/content/captionLengths.tslib/content/songsSchema.tslib/content/validateCreateContentBody.ts
✅ Files skipped from review due to trivial changes (2)
- lib/content/songsSchema.ts
- lib/content/captionLengths.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- lib/agents/content/createContentPromptAgent.ts
| import { CAPTION_LENGTHS } from "@/lib/content/captionLengths"; | ||
|
|
||
| export { CAPTION_LENGTHS }; |
There was a problem hiding this comment.
Why is this export needed?
Nothing imports CAPTION_LENGTHS from validateCreateContentBody — the re-export was YAGNI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When songs are specified, the ack message now shows which songs will be used (e.g. "using hiccups, adhd"). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use Slack-compatible markdown (*bold* not **bold**) and bullet list for details including song names, template, lipsync, and video count. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
songsfield to the AI prompt parser schema (contentPromptFlagsSchema) so the agent extracts song names from natural-language Slack mentionssongsarray fromregisterOnNewMentionhandler through totriggerCreateContentpayloadTest plan
parseContentPromptextracts songs when mentioned in promptparseContentPromptreturns undefined songs when not mentionedregisterOnNewMentionpasses songs totriggerCreateContentregisterOnNewMentionomits songs when not specifiedCloses REC-38
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Refactor
Validation